package oa.hleast.xswl.service.activity.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import oa.hleast.xswl.mapper.activity.CmsActivityAttrValueMapper;
import oa.hleast.xswl.pojo.domain.activity.CmsActivityAttrValue;
import oa.hleast.xswl.service.activity.ICmsActivityAttrValueService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Slf4j
@Transactional
@AllArgsConstructor
public class CmsActivityAttrValueServiceImpl extends ServiceImpl<CmsActivityAttrValueMapper, CmsActivityAttrValue> implements ICmsActivityAttrValueService {
    @Override
    public boolean add(CmsActivityAttrValue form) {
        return this.save(form);
    }

    @Override
    public boolean update(CmsActivityAttrValue form) {
        return this.update(form);
    }

    @Override
    public Page<CmsActivityAttrValue> pageList(Integer page, Integer limit, String typeName, Integer display) {
        return this.page(new Page<>(page, limit), new LambdaQueryWrapper<CmsActivityAttrValue>()
                .orderByDesc(CmsActivityAttrValue::getGmtCreate)
                .orderByDesc(CmsActivityAttrValue::getGmtModified)
        );
    }

    @Override
    public boolean deleteByIds(List<String> asList) {
        return this.removeByIds(asList);
    }

    @Override
    public CmsActivityAttrValue detail(Long id) {
        return this.getById(id);
    }
}
